﻿using System;

namespace Cloak.Mvvm.Bindings
{
	/// <summary>
	/// Describes a binding between a source object and a view model
	/// </summary>
	public interface IViewModelBinding
	{
		/// <summary>
		/// Gets whether the view model's data differs from the source data
		/// </summary>
		bool IsModified { get; }

		/// <summary>
		/// Occurs when the value of the <see cref="IsModified"/> property changes
		/// </summary>
		event EventHandler IsModifiedChanged;

		/// <summary>
		/// Reads from the source object and sets values on the view model
		/// </summary>
		void BindFromSource();

		/// <summary>
		/// Reads from the view model and sets values on the source object
		/// </summary>
		void BindToSource();
	}
}